import time
start=time.time()
sp=[]
with open('m1_sorted.txt') as f:
    for x in f:
        sp.append(int(x))
N=len(sp)
for i in range(N-1):
    for j in range(N-i-1):
        if sp[j]>sp[j+1]:
            sp[j],sp[j+1]=sp[j+1],sp[j]
end=time.time()

start2=time.time()
sp=[]
with open('m2_reverse.txt') as f:
    for x in f:
        sp.append(int(x))
N=len(sp)
for i in range(N-1):
    for j in range(N-i-1):
        if sp[j]>sp[j+1]:
            sp[j],sp[j+1]=sp[j+1],sp[j]
end2=time.time()

start3=time.time()
sp=[]
with open('m3_shuffle.txt') as f:
    for x in f:
        sp.append(int(x))
N=len(sp)
for i in range(N-1):
    for j in range(N-i-1):
        if sp[j]>sp[j+1]:
            sp[j],sp[j+1]=sp[j+1],sp[j]
end3=time.time()
print('m1_sorted.txt',(end-start) * 10**3,'ms')
print('m2_reverse.txt',(end2-start2) * 10**3,'ms')
print('m3_shuffle.txt',(end3-start3) * 10**3,'ms')